﻿using System.Runtime.Serialization;

namespace TimeTravel.Components
{
    /// <summary>
    /// 产品信息
    /// </summary>
    [DataContract]
    public class ProductInfo : BaseComponent
    {
        /// <summary>
        /// 产品名称
        /// </summary>
        [DataMember(Name = "name")]
        public string Name { get; set; }

        /// <summary>
        /// 产品描述
        /// </summary>		
        [DataMember(Name = "descr")]
        public string Descr { get; set; }

        /// <summary>
        /// 排序（越大越靠前。默认为0）
        /// </summary>		
        private int _sort;
        [DataMember(Name = "sort")]
        public int Sort
        {
            get { return _sort; }
            set
            {
                if (value < 0)
                {
                    value = 0;
                }
                _sort = value; 
            }
        }

        /// <summary>
        /// 产品图片
        /// </summary>		
        [DataMember(Name = "picture")]
        public string Picture { get; set; }

        /// <summary>
        /// 查看次数
        /// </summary>		
        [DataMember(Name = "click")]
        public int Click { get; set; }

        /// <summary>
        /// 产品详细介绍
        /// </summary>		
        [DataMember(Name = "detail")]
        public string Detail { get; set; }
    }
}